﻿namespace HTMLService
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Collections.Specialized;

    public partial class DialogMaster : System.Web.UI.UserControl
    {
        public string ChildControlPath { get; set; }
        public Dictionary<string, object> ChildControlProperty { get; set; }
        public string PopUpDivId { get; set; }
        public PopupSize PopupSize { get; set; }


        protected void Page_Load(object sender, EventArgs e)
        {
            SetImageUrlProperty(PopupSize);
        }

        public string GetChildControlHtml()
        {
            return HTMLService.PopupHelper.RenderUserControl(ChildControlPath, ChildControlProperty, "ContentArea");
        }

        public string TopImageFileName { get; set; }
        public string BodyImageFileName { get; set; }
        public string FooterImageFileName { get; set; }
        public string ModelTopClass { get; set; }
        public string ModelBodyClass { get; set; }
        public string ModelBottomClass { get; set; }
        public string PopupSizeText { get; set; }

        private void SetImageUrlProperty(PopupSize popupType)
        {
            switch (popupType)
            {
                case PopupSize.Small:
                    TopImageFileName = @"/portals/28/images/Popup_Top_BG.png";
                    BodyImageFileName = @"/portals/28/images/Popup_Middle_BG.gif";
                    FooterImageFileName = @"/portals/28/images/Popup_Bottom_BG.png";
                    ModelTopClass = "modelTop";
                    ModelBodyClass = "modalBody";
                    ModelBottomClass = "modelBottom";
                    PopupSizeText = "Small";
                    break;
                case PopupSize.Medium:
                    TopImageFileName = @"/portals/28/images/Popup_Top_BG.png";
                    BodyImageFileName = @"/portals/28/images/Popup_Middle_BG.gif";
                    FooterImageFileName = @"/portals/28/images/Popup_Bottom_BG.png";
                    ModelTopClass = "modelTop";
                    ModelBodyClass = "modalBody";
                    ModelBottomClass = "modelBottom";
                    PopupSizeText = "Medium";
                    break;
                case PopupSize.Big:
                    TopImageFileName = @"/portals/28/images/PopUp/Popup_Top_BG_947.png";
                    BodyImageFileName = @"/portals/28/images/PopUp/Popup_Middle_BG_947.gif";
                    FooterImageFileName = @"/portals/28/images/PopUp/Popup_Bottom_BG_947.png";
                    ModelTopClass = "modelTop947";
                    ModelBodyClass = "modalBody947";
                    ModelBottomClass = "modelBottom947";
                    PopupSizeText = "Big";
                    break;
                default:
                    TopImageFileName = @"/portals/28/images/Popup_Top_BG.png";
                    BodyImageFileName = @"/portals/28/images/Popup_Middle_BG.gif";
                    FooterImageFileName = @"/portals/28/images/Popup_Bottom_BG.png";
                    ModelTopClass = "modelTop";
                    ModelBodyClass = "modalBody";
                    ModelBottomClass = "modelBottom";
                    PopupSizeText = "Big";
                    break;
            }
        }
    }
}